package org.zachary.prosocialbehaviorservice.application.event_listener;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;
import org.zachary.prosocialbehaviorservice.domain.aggregate_model.activity.event.*;

@Slf4j
@Component
public class ActivityEventListener {
    @TransactionalEventListener
    public void onActivityAdd(AddActivityEvent event) {
        log.info("活动添加成功，活动详情为：{}",event.getActivity());
    }
    @Async
    @TransactionalEventListener
    public void onActivityDelete(DeleteActivityEvent event) {
        log.info("活动类型删除成功，活动详情为：{}",event.getSource());
    }
    @TransactionalEventListener
    public void onActivityModify(ModifyActivityEvent event) {
        log.info("活动类型修改成功，活动详情为：{}",event.getSource());
    }
    @TransactionalEventListener
    public void onActivityItemList(ActivityItemListEvent event) {
        log.info("活动项列表加载成功，详情为：{}",event.getSource());
    }
    @TransactionalEventListener
    public void onActivityList(LoadAllActivityEvent event) {
        log.info("活动列表加载成功，详情为：{}",event.getSource());
    }
}
